package com.changan.action;

import com.changan.pojo.SmbmsUser;
import com.changan.service.UserService;
import com.opensymphony.xwork2.ActionSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller("userAction")
public class UserAction extends ActionSupport {

    private List<SmbmsUser> users;

    public List<SmbmsUser> getUsers() {
        return users;
    }

    public void setUsers(List<SmbmsUser> users) {
        this.users = users;
    }

    @Autowired
    @Qualifier("userService")
    private UserService userService;

    public String findUsers() {
        List<SmbmsUser> users = userService.findUsers();
        if (users.size() > 0) {
            System.out.println("fsdfsdfwefew");
            System.out.println("faerw3rwerwer");
            System.out.println("===========");
            this.setUsers(users);
            return "success";
        } else {
            return "input";
        }
    }
}
